package com.cicc.beergamevirtualsimulationsystem.common.enums;

import com.cicc.beergamevirtualsimulationsystem.common.exception.BizException;

import java.util.Arrays;

public interface BaseEnum {
    Integer getCode();

    String getDesc();

    static <T extends BaseEnum> Boolean match(Class<T> enumClass, Integer code) {
        return Arrays.stream(enumClass.getEnumConstants())
                .map(BaseEnum::getCode)
                .anyMatch(v -> v.equals(code));
    }
}

